// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_fk;

import android.content.Context;
import android.graphics.Rect;
import android.text.Editable;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.EditText;

public class cls_SplitTextEdit extends EditText
{

    public cls_SplitTextEdit(Context context)
    {
        super(context);
        a = false;
        b = "SplitTextEdit";
        d = false;
    }

    public cls_SplitTextEdit(Context context, AttributeSet attributeset)
    {
        super(context, attributeset);
        a = false;
        b = "SplitTextEdit";
        d = false;
    }

    public cls_SplitTextEdit(Context context, AttributeSet attributeset, int i)
    {
        super(context, attributeset, i);
        a = false;
        b = "SplitTextEdit";
        d = false;
    }

    private char a(CharSequence charsequence)
    {
        int i = charsequence.length();
while(true)
{
        char c1;
        int j;
        if(i <= 0)
            {
        	c1 = '\0';
        	return c1;
            }
        j = i + -1;
        c1 = charsequence.charAt(j);
        if(c1 == ' ' || c1 == '\n' || c1 == '\r') {
        	i = j;
        } else return c1;
}
 
    }

    private int a(int i)
    {
    	int j = 0;
        Editable editable;
        editable = getText();
        if(i >= editable.length())
            i = -1 + editable.length();
while(true)
{
        if(i < 0)
            {
        	j = 0;
        	return j;
            }
        if(editable.charAt(i) != c) {
        	i--;
        	continue;
        } else {
        	j = i + 1;
        	return j;
        }
}
 
    }

    private boolean a()
    {
        Editable editable = getText();
        int i = getSelectionStart();
        boolean flag;
        if(i == getSelectionEnd() && i > 0 && editable.charAt(i + -1) == c)
        {
            int j = i + -1;
            if(j > 0)
                j = a(j + -1);
            setSelection(j, i);
            flag = true;
        } else
        {
            flag = false;
        }
        return flag;
    }

    private int b(int i)
    {
        Editable editable = getText();
        if(i < 0)
            i = 0;
        int j = editable.length();
        do
        {
label0:
            {
                if(i < j)
                {
                    if(editable.charAt(i) != c)
                        break label0;
                    if(i < j)
                        j = i + 1;
                }
                return j;
            }
            i++;
        } while(true);
    }

    public void a(char c1)
    {
        c = c1;
    }

    protected void onFocusChanged(boolean flag, int i, Rect rect)
    {
        d = true;
        super.onFocusChanged(flag, i, rect);
        d = false;
    }

    public boolean onKeyDown(int i, KeyEvent keyevent)
    {
        boolean flag = true;
        d = flag;
        if(i != 67 || flag != a())
            flag = super.onKeyDown(i, keyevent);
        return flag;
    }

    public boolean onKeyUp(int i, KeyEvent keyevent)
    {
        d = false;
        return super.onKeyUp(i, keyevent);
    }

    protected void onSelectionChanged(int i, int j)
    {
        super.onSelectionChanged(i, j);
        if(i == j && i >= 0 && j >= 0 && !d && (i < e || j > f || e == f))
            setSelection(a(i), b(i));
        e = getSelectionStart();
        f = getSelectionEnd();
    }

    protected void onTextChanged(CharSequence charsequence, int i, int j, int k)
    {
        super.onTextChanged(charsequence, i, j, k);
        if(a(charsequence) != c && charsequence.length() > 0)
        {
            append(Character.toString(c));
            d = true;
            setSelection(-1 + charsequence.length());
            d = false;
        }
    }

    public boolean onTouchEvent(MotionEvent motionevent)
    {
        return super.onTouchEvent(motionevent);
    }

    public void onWindowFocusChanged(boolean flag)
    {
        boolean flag1;
        if(!flag)
            flag1 = true;
        else
            flag1 = false;
        d = flag1;
        super.onWindowFocusChanged(flag);
    }

    private static char c = ';';
    private final boolean a;
    private final String b;
    private boolean d;
    private int e;
    private int f;

}
